package com.jp.knowledge.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by jiayen on 16/9/27.
 */
public class TopicViewPageAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragments;
    private List headLines;

    public TopicViewPageAdapter(FragmentManager fm, List<Fragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments == null ? null : fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments == null ? 0 : fragments.size();
    }

    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {

//        CommNewsFragment  fragment = (CommNewsFragment) super.instantiateItem(container,position);
//        if(headLines!=null&&headLines.size()>0)
//        fragment.newInstance(headLines.get(position).getTypeId());
        return super.instantiateItem(container, position);
    }
}
